<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8" />
		<title></title>
		<style type="text/css">
			.container{
				width: 470px;
				margin: 0px auto;				
			}
		</style>
	</head>
	<body>
		<div class="container">
			<img width="470" height="200" src="img/0.jpg" id="imgs"/>
		</div>
		<input type="button" value="切换" id="btn"/>
		<input type="button" value="边框" id="btn2"/>
		<script type="text/javascript">
			var btn=document.getElementById("btn");
			var img=document.getElementById("imgs");
			var i=0;
			btn.onclick=function (e) {
				i++;
				if(i>4) i=0;
				img.src="img/"+i+".jpg";
			}
			var btn2=document.getElementById("btn2");
			btn2.onclick=function () {
				var dv=document.getElementsByClassName("container")[0];
				//dv.style.border="solid red 5px";
				dv.style.borderStyle="dashed";
				dv.style.borderColor="#369";
				dv.style.borderWidth="10px";
			}
		</script>
	</body>
</html>
